package cn.xing.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.xing.dao.MessageDAO;
import cn.xing.model.Message;

@Service
public class MessageService {
	@Autowired
	MessageDAO messageDAO;

	public int addMessage(Message message) {
		return messageDAO.addMessage(message);
	}

	public List<Message> getConversationDetail(String conversationId, int offset, int limit) {
		return messageDAO.getConversationDetail(conversationId, offset, limit);
	}

	public List<Message> getConversationList(int userId, int offset, int limit) {
		return messageDAO.getConversationList(userId, offset, limit);
	}

	public int getConvesationUnreadCount(int userId, String conversationId) {
		return messageDAO.getConvesationUnreadCount(userId, conversationId);
	}
}
